
import query from '@dfeidao/atom-nodejs/db/query';
import { file_url, spaceid, systemid } from '../../atom/config';


interface Message {
	productid: string;
}


export default async function atom(msg: Message, action_id: string, session_id: string) {
	const q = query(action_id, session_id, systemid);
	q.prepare('company', ['company_name', 'logo'], { productid: msg.productid }, 1, 1, [], []);
	const [data] = await q.exec<{ logo: string, logo1: string }>();
	data.forEach((v) => {
		if (v.logo) {
			return v.logo1 = `${file_url}/getfile?productid=${spaceid}&id=${v.logo}`;
		} else {
			return v.logo1 = '';
		}
	});
	return { dataArray: data };
}
